package com.gxa.modules.pc.hospital.service.impl;

import com.gxa.modules.app.outpatient.medical.dto.*;
import com.gxa.modules.app.outpatient.medical.mapper.AppItemsMapper;
import com.gxa.modules.app.outpatient.medical.mapper.AppMedicalRecordMapper;
import com.gxa.modules.app.outpatient.medical.mapper.AppPackageMapper;
import com.gxa.modules.app.outpatient.medical.mapper.AppPackageTypeMapper;
import com.gxa.modules.app.outpatient.medical.service.MedicalService;
import com.gxa.modules.model.dto.ItemsDto;
import com.gxa.modules.model.dto.PackageDto;
import com.gxa.modules.model.entity.hospital.MedicalRecord;
import com.gxa.modules.model.vo.ItemsVo;
import com.gxa.modules.model.vo.PackageVo;
import com.gxa.modules.pc.hospital.mapper.ItemsMapper;
import com.gxa.modules.pc.hospital.service.ItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ItemsServiceImpl implements ItemsService {

    @Autowired
    private ItemsMapper itemsMapper;


    @Override
    public Map<String,Object> queryAll(ItemsVo itemsVo) {
        Map map = new HashMap();
        Integer page = (itemsVo.getPage()-1)*itemsVo.getSize();
        itemsVo.setPage(page);
        List<ItemsDto> itemsDtos = this.itemsMapper.queryAll(itemsVo);
        Integer count = this.itemsMapper.count();
        map.put("items",itemsDtos);
        map.put("count",count);
        return map;
    }

    @Override
    public void delById(List<Long> lists) {
        this.itemsMapper.del(lists);
    }

    @Override
    public void updateStateById(Integer id, Integer state) {
        this.itemsMapper.updateStateById(id, state);
    }

    @Override
    public ItemsDto queryById(Integer id) {
        ItemsDto itemsDto = this.itemsMapper.queryById(id);
        return itemsDto;
    }

    @Override
    public void update(ItemsDto itemsDto) {
        this.itemsMapper.update(itemsDto);
    }

    @Override
    public void add(ItemsDto itemsDto) {
        this.itemsMapper.add(itemsDto);
    }
}
